
    /// <summary>
    /// 输入道路、车辆、环境数据，判断是否能够通行
    /// </summary>
    /// <param name="truck">车辆数据</param>
    /// <param name="road">道路数据</param>
    /// <param name="vironments">环境数据</param>
    /// <returns></returns>
    //  function ifPass(Truck truck, Road road, Environments environments)
    function ifPass(truck, road, environments) {
        //int flag = 1;
        if (!judgeWeight(truck.totalWeight, road.weight, 0))
            return 1;
        if (!judgeHeight(truck.maxHeight, road.height, 0))
            return 2;
        if (!judgeWidth(truck.maxWidth, road.wight, 0))
            return 3;
        if (!judgeTurningCircle(truck.turningCircle, road.turningCircle, 1))
            return 4;
        if (!judgeSlope(truck.maxSlope, road.slope, 1))
            return 5;
        if (!judgeSpeed(truck.currentSpeed, road.limitSpeed, 1))
            return 6;
        if (!judgeStatus(road.status, 1))
            return 7;
        if (!judgeTime(road.Timelimit1, road.Timelimit2, environments.Time, 1))
            return 8;
        return 0;
    }


    /// <summary>
    /// 判断车辆总重是否超过路面承重能力
    /// </summary>
    /// <param name="t_wight">车辆总重</param>
    /// <param name="r_wight">路面总重</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns></returns>
    // function judgeWeight(float t_wight, float r_wight, int flag)
    function judgeWeight(t_wight,r_wight, flag)
    {
        if (flag == 1) {
            return true;
        }
        if (t_wight > r_wight) {
            return false;
        }
        return true;
    }

    /// <summary>
    /// 判断车辆高度是否超过路面限高
    /// </summary>
    /// <param name="t_height">车辆最大高度</param>
    /// <param name="r_height">路面限高</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns>若超过，返回false</returns>
    // public bool judgeHeight(float t_height, float r_height, int flag)
    function judgeHeight(t_height,r_height, flag)
    {
        if (flag == 1) {
            return true;
        }
        if (t_height > r_height) {
            return false;
        }
        return true;
    }

    /// <summary>
    /// 判断车辆宽度是否超过路面限宽
    /// </summary>
    /// <param name="t_width">车辆最大宽度</param>
    /// <param name="r_width">路面限宽</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns>若超过，返回false</returns>
    // public bool judgeWidth(float t_width, float r_width, int flag)
    function judgeWidth(t_width,r_width,flag)
    {
        if (flag == 1) {
            return true;
        }
        if (t_width > r_width) {
            return false;
        }
        return true;
    }

    /// <summary>
    /// 判断车辆需要的最小转弯半径是否超过路面转弯半径
    /// </summary>
    /// <param name="t_TurningCircle">车辆需要的最小转弯半径</param>
    /// <param name="r_TurningCircle">路面转弯半径</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns>若超过，返回false</returns>
    // public booln judgeTurningCircle(float t_TurningCircle, float r_TurningCircle, int flag)
    function judgeTurningCircle(t_TurningCircle,r_TurningCircle, flag)
    {
        if (flag == 1) {
            return true;
        }
        if (t_TurningCircle > r_TurningCircle) {
            return false;
        }
        return true;
    }

    /// <summary>
    ///  判断车辆当前重量下最大爬坡度是否超过路面坡度
    /// </summary>
    /// <param name="t_Slope">车辆最大爬坡度</param>
    /// <param name="r_Slope">路面坡度</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns>若超过，返回true</returns>
    // public bool judgeSlope(float t_Slope, float r_Slope, int flag)
    function judgeSlope(t_Slope, r_Slope, flag)
    {
        if (flag == 1) {
            return true;
        }
        if (t_Slope < r_Slope) {
            return false;
        }
        return true;
    }

    /// <summary>
    /// 判断车辆当前速度是否超过道路限速
    /// </summary>
    /// <param name="t_Speed">车辆当前速度</param>
    /// <param name="r_Speed">道路限速</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns>若超过，返回false</returns>
    // public bool judgeSpeed(float t_Speed, float r_Speed, int flag)
    function judgeSpeed(t_Speed,  r_Speed,  flag)
    {
        if (flag == 1) {
            return true;
        }
        if (t_Speed > r_Speed) {
            return false;
        }
        return true;
    }

    /// <summary>
    /// 判断道路状态是否能够通行
    /// </summary>
    /// <param name="r_status">道路状态</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns></returns>
    // public bool judgeStatus(string r_status, int flag)
    function judgeStatus( r_status,  flag)
    {
        if (flag == 1) {
            return true;
        }
        if (r_status == "control") {
            return false;
        }

        //其他道路状态
        return true;
    }

    /// <summary>
    /// 判断当前时间，当前道路是否限行
    /// </summary>
    /// <param name="start">道路限行开始时间,若为null，则直接返回true</param>
    /// <param name="end">道路限行结束时间,若为null，则直接返回true</param>
    /// <param name="now">当前时间</param>
    /// <param name="flag">预留参数，若为1直接返回true</param>
    /// <returns>若当前时间在限行时间段内，返回false</returns>
    // public bool judgeTime(DateTime start, DateTime end, DateTime now, int flag)
    function judgeTime(start, end, now, flag)
    {
        if (flag == 1 || start == null || end == null) {
            return true;
        }
        if (DateTime.Compare(start, now) < 0 && DateTime.Compare(now, end) < 0) {
            return false;
        }
        return true;
    }


